﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace RrslLite.Net.Messages
{
    [DataContract]
    public class Message : ICorrelatedMessage
    {
        public Message()
        {
            OperationParameters = new Dictionary<string, object>();
        }

        public Message(Guid correlationId) : this()
        {
            CorrelationId = correlationId;
        }

        [DataMember]
        public Guid CorrelationId { get; set; }

        /// <summary>
        /// Method of object from Spring factory
        /// </summary>
        [DataMember]
        public string OperationName { get; set; }

        /// <summary>
        /// Object defined in Spring factory
        /// </summary>
        [DataMember]
        public string OperationContainerName { get; set; }

        /// <summary>
        /// Parameters of object's method from Castle factory
        /// </summary>
        [DataMember]
        public Dictionary<string, object> OperationParameters { get; set; }

        /// <summary>
        /// Result of query
        /// </summary>
        [DataMember]
        public object Result { get; set; }

        /// <summary>
        /// Is result the exception
        /// </summary>
        [DataMember]
        public bool ContainsException { get; set; }
    }
}
